/*
 * @Author: Leo.wang wanglizhigs@163.com
 * @Date: 2024-05-11 22:48:34
 * @LastEditors: Leo.wang wanglizhigs@163.com
 * @LastEditTime: 2024-05-13 23:16:57
 * @FilePath: /gptfront-dev/src/store/modules/AIModel.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/*
 * @Author: Leo.wang wanglizhigs@163.com
 * @Date: 2024-05-11 22:48:34
 * @LastEditors: Leo.wang wanglizhigs@163.com
 * @LastEditTime: 2024-05-11 23:46:20
 * @FilePath: /gptfront-dev/src/store/modules/AIModel.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineStore } from 'pinia'
import { AI_MODELS } from '@/model/index'
const { VITE_DEFAULT_AI_MODEL } = import.meta.env

const useAIModelStore = defineStore({
  id: 'AIModelStore',
  state: () => ({
    AIModel: AI_MODELS.find((item) => item.name === VITE_DEFAULT_AI_MODEL),
    AIModels: AI_MODELS,
  }),
  getters: {},
  actions: {
    toggleAIModel(name) {
      this.AIModel = AI_MODELS.find((item) => item.name === name)
    },
    toggleByVersion(version) {
      const model = AI_MODELS.find((item) => item.version === version)
      if (model) {
        this.AIModel = model
      }
    },
  },
})
export default useAIModelStore
